package com.situ.day3;
//实体类

public class Student /*extends Object*/{
	// 属性 field
	private int id;
	private String name;
	private int age;
	private String className;
	
	//无参构造方法
	//如果不写，Java默认提供这样一个无参构造方法.
	//如果你写了，Java就不会再提供这个无参构造方法
	public Student() {
		super();
		// syst
		System.out.println("Student.Student()");
	}
	
	//有参构造方法
	public Student(int id, String name, int age, String className) {
		System.out.println("Student.Student()111");
		this.id = id;
		this.name = name;
		this.age = age;
		this.className = className;
	}
	
	// 方法（功能）
	public void study() {
		System.out.println("Student.study()");
		// 豆豆加加
		System.out.println(className + "班的" + name + "正在学习");
	}

	@Override
	public String toString() {
		return "Student [id=" + id + ", name=" + name + ", age=" + age + ", className=" + className + "]";
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		// 对非法的年龄进行控制
		if (age > 0 && age < 120) {
			this.age = age;
		}
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}
	
}
